package com.hdy.orderforthree.widget;

import android.content.Context;

public class ConcretePopFactory extends PopFactory {

    public static final int ORDER_POP = 0;
    public static final int MY_BILL_POP = 1;

    private int mCurrentPop = ORDER_POP;

    private static ConcretePopFactory sConcretePopFactory;

    private ConcretePopFactory() {

    }

    public static ConcretePopFactory getInstance() {
        if (sConcretePopFactory == null) {
            synchronized (ConcretePopFactory.class) {
                if (sConcretePopFactory == null) {
                    sConcretePopFactory = new ConcretePopFactory();
                }
            }
        }
        return sConcretePopFactory;
    }

    @Override
    public BasePop CreatePop(int type, Context context) {
        mCurrentPop = type;
        switch (type) {
            case ORDER_POP:
                return new OrderBasePop(context);
            case MY_BILL_POP:
                return new BillBasePop(context);
            default:
                return new OrderBasePop(context);
        }
    }

    public int getCurrentPop() {
        return mCurrentPop;
    }
}
